import axios from '../../libs/request'

/**
 * 管理员注册
 * @param {*} phoneNumber 
 * @param {*} email 
 * @param {*} name 
 * @param {*} password 
 * @param {*} role 
 */
export const register = (
  phoneNumber,
  email,
  name,
  password,
  role
) => axios.request({
  url: '/api/v1/auth/register',
  method: 'put',
  data: {
    phoneNumber,
    email,
    name,
    password,
    role
  }
})

/**
 * 管理员登录
 * @param {*} email 
 * @param {*} password 
 * @param {*} phoneNumber 
 */
export const login = (email, password, phoneNumber = 0) => axios.request({
  url: '/api/v1/auth/login',
  method: 'post',
  data: {
    email,
    password,
    phoneNumber
  }
})

/**
 * 退出登录
 */
export const logout = () => axios.request({
  url: '/api/v1/auth/logout',
  method: 'delete'
})